﻿using System;
using System.Collections.Generic;
using System.Linq;
using Simple.Data;

namespace Model.User
{
    public class Teacher : Person
    {
        public Teacher(Person p)
        {
            int role = p.getRole();
            if (role != 1)
                throw new Exception("Preson ID = " + p.getId() +" is not a teacher!");

            id = p.getId();
            firstName = p.getFirstName();
            lastName = p.getLastName();
            password = p.getPassword();
            email = p.getEmail();
            picturePath = p.getPicturePath();
            role = p.getRole();
        }

        public static new Teacher get(int id)
        {
            Person p = Person.get(id);

            Teacher t = null;

            try
            {
                t = new Teacher(p);
            }
            catch (Exception e)
            {
                t = null;
            }

            return t;
        }

        public bool isLeadingCourse(Course.Course course)
        {
            if (course == null) return false;

            return course.getLecturer().getId() == this.getId();
        }

        public bool isLeadingCourse(int courseId)
        {
            return isLeadingCourse(Course.Course.get(courseId));
        }

        public void addCourse ()        
        {
            
        }
        public void deleteCourse ()        
        {
            
        }
        public void addTask ()        
        {
            
        }
        public void editTask ()        
        {
            
        }
        public void markTask ()        
        {
            
        }
        public void addLecture ()        
        {
            
        }
        public void editLecture ()        
        {
            
        }
        public void deleteLecture ()        
        {
            
        }
    }
}